﻿<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>会员等级表</title>
    <link href="/style/rightdirectory.css" rel="stylesheet" />
    <script src="/script/config.js"></script>
</head>
<style>
    th {
        text-align: center;
    }

    td {
        text-align: center;
    }
</style>
<body>
    <div class="view-page">
        <!--搜索区域-->       
        <div class="view-eidt-btns">         
            <a  href="javascript:;" class="btn btn-sm" data-btn-eidt="/views/customer/member/edit.html?v=">
                <i class="fa fa-edit"></i>编辑
            </a>         
        </div>
        <div class="view-data">
            <table id="table" class="table table-bordered table-hover" data-post="">
                <thead>
                    <tr>
                        <th class="checkboxs">
                            <label class="checkbox-reset">
                                <input type="checkbox" data-checked-table="all" />
                            </label>
                        </th>
                        <th>会员等级</th>
                        <th>折扣比例</th>
                        <th>创建时间</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
            <!--分页条 默认选择id=list-page元素-->
            <div id="list-page" class="view-pagination-page"></div>
        </div>
    </div>

   
</body>

</html>
<script type="text/html" id="tp-table">
    {{each list d}}
    <tr data-eidt="{{d.Id}}">
        <td class="checkboxs">
            <label class="checkbox-reset">
                <input type="checkbox" value="{{d.Id}}" data-checked-table="single" />
            </label>
        </td>
        <td>{{d.VipName}}</td>
        <td>{{d.Discount*100}}%</td>
        <td>{{d.CreateDate|to_date}}</td>
    </tr>
    {{/each}}
</script>

<script type="text/javascript">
    $(function() {
        function _LoadData() {
            var parm = $(".view-search").getFormData();
            $.http.json("cvip/list", parm,
                {
                    pass: function (d) {                      
                        $("#table>tbody").append(template("tp-table", {
                            list: d
                        }));
                    }
                })
        }
        _LoadData();//初启化
        $(".form-control").focus(function () { //搜索按钮
            $(".form-control").keydown(function(e) {
                if (e.keyCode == 13) {
                    _LoadData();
                }
            })
        })    
        $("#btn-search").click(function() { //搜索按钮
            _LoadData();
        })     
    })
</script>